Learning to Program

by Alan Gauld

Stop Press!

The Book

My book is now available in a second printing. Amazon at least are selling the second print, I assume others will follow suit. The second printing, fixes most of the errors in the first printing (It tells you at the bottom of the publishers info page, opposite the dedication which print you have).

The book (in either printing) significantly improves the explanations on the web version, albeit only in Python. it also has extra examples and several completely new chapters compared to the web site. These include a brand new case study for an OO games framework. (A fully commented version of the framework is now available on the Useless Python website as hmgui.zip.) I hope that anyone who has found my web site useful will find the book equally so.

BTW Despite what several of the amazon reviews say, there are some excercises in the book, they are just contained within the text rather than explicitly placed at the end of the chapter - I personally hate that style of excercise.

The publishers web page has the some details. You can order it on Amazon here. Most of the other online bookshops have it in stock too.

There is also a Japanese version available from the Japanese branch of my publishers.

I now have a web site set up listing errata and providing opportunities to send feedback and questions. Please pay a visit, especially if you've bought the book!

The Web Tutor

This site is still being maintained and improved even after the book has come out and already several new topics have been added (see below for details).

Non English Editions now available!

Martin Pozzi was the first to translate the tutor (into Spanish) and he has now been followed by several others. The following versions are available:

LanguageTranslator
Czech local copy OR the translator's website Soňa Reisnerová
German Bruno Schaefer
Korean johnsonj
Italian Luca Fini
Portuguese Wilson Edgar
Spanish Martin Pozzi

The tutors above are nearly complete. The Czech one in particular is very professionally presented including a more attractive appearance - provided you are using Microsoft Internet Explorer. (The Javascript does not work properly in Netscape. Also the layout of the code is not especially clear.) There is a new translator working on tidying up all of the issues and hopefully the benefits will accrue to the other pages in time too. Meanwhile it is still worth reading and you can cross check with the English version to see how the code should look.

An Italian translation is underway now too and the first few pages are available now..

There may be one or two chapters still to come in some of the translations but they are all in a useful state. I think all of the translators deserve a vote of thanks for their efforts in putting this together. If anyone else wishes to do a translation just send me an email.

As mentioned above there is a Japanese version of my book available too.

New Stuff

Two new topics have been added: Programming GUIs using Tkinter. As with the rest of the site the intent is to provide just enough background to make the official Tkinter tutor comprehensible.

Another new topic is: Functional Programming. As with the rest of the site the intent is to provide just enough background to make references to FP understandable and at the same time introduce the very powerful FP functions of Python.

Download Archive Format Change

There are still problems with the archives. The files seem to get corrupted from time to time and different users have problems regardess of which format I use. The only solution seems to be to post both zip and tgz formats. Hopefully this will keep everyone happy!

Linux users can download the tar/gzip version.

Windows users should be able to use that version too since winzip and the freeware archiver Quick Zip by Joseph Leung can both cope with tgz format. I'll also be using tgz format for the non English versions, just look at the bottom of the contents frame for a link.

The zip version can be had here.

This way everyone is happy - I hope!

And Palm Users Too...

One Palm user has created a Palm doc file. I haven't had a chance to try it yet but offer it here for those who want it. If anyone has problems with this one then you're on your own, it's unsupported. But hopefully it will be useful to someone.

EMAIL PROBLEMS

Crosswinds are about to terminate their POP3 mail service so I will be changing the links on the pages to the btinternet address shown here:
alan.gauld@btinternet.com

The crosswinds address will keep working but I can only access it via webmail which is less convenient for me. Use the links if you prefer but be aware that response times may be worse on the crosswinds links than via btinternet.


Introduction - What, Why, Who etc.

Why am I writing this?

The reason I am creating this tutorial is that there seems to be very little for the absolute beginner to programming on the Web. Yet the Internet and the Web encourage interest in computers and that interest naturally leads to a desire to "take control", which means learning to program!

Why me? Well I am a professional programmer who came to programming from an electronic engineering background. I have used (and continue to use) several computer languages and don't have any personal interest in promoting any particular tool or language. Oh, and nobody else seemed to be doing it!

What will I cover

As much as I can. I will cover the basic theory of computer programming - what it is, some of its history and the basic techniques needed to solve problems. I will not be teaching esoteric techniques or the details of any particular programming language, in fact I'll be using several different languages, since I believe its important to realize that different languages do different things well. That said, the majority of the course will be in the language called Python.

Who should read it?

Put another way: what do I expect the reader to know already?

I expect the reader of this tutorial to be an experienced user of a computer system, probably MS DOS, Windows or Unix although others should be able to cope too. I also expect them to understand basic mathematical concepts such as geometric coordinates, sets, and basic algebra. These are all important in todays programming environments, and many programming concepts are based on these ideas.

I certainly will not be covering issues like how to create or copy text files, how to install software, or the organization of files on a computer storage system. Frankly if you need to know those things you probably are not at the stage of being able to program, regardless of your desire to do so. Find a tutorial for your computer first, then when you're confident with the above concepts revisit.

Why Python?

Python happens to be a nice language to learn. Its syntax is simple and it has some very powerful features built into the language. It supports lots of programming styles from the very simple through to state of the art Object Oriented techniques. It runs on lots of platforms - Unix/Linux, MS Windows, Macintosh etc. It also has a very friendly and helpful user community. All of these are important features for a beginner's language.

Python however is not just a beginner's language. As your experience grows you can keep on using Python either as an end in itself or as a rapid prototyping language. There are a few things that Python is not well suited to, but these are comparatively few and far between.

I will also use BASIC for some of the very early examples then introduce Tcl as an alternative. Why? Well, if we accept that most Web surfers who are also beginners are using PCs with Microsoft Windows installed, there is a version of BASIC(QBASIC) already available on the CD ROM (either NT or Win 95/98). Tcl comes with versions of Python up to V1.5.2 (you effectively get two languages for the price of one - which in this case is nothing!) After version 2.0 you only get a minimal Tcl install so to do the examples you will need to download the official Tcl installer from Scriptics.

Other resources

There are other Web sites trying to do this in other languages. There are also lots of tutorials for those who already know how to program but want to learn a new language. This section contains links to some of those that I think are worthwhile!


Next  Contents

If you have any ideas on how to improve this tutorial
please feel free to contact me